package com.easy.service.impl;

import com.easy.bean.Room_maintenance;
import com.easy.mapper.Room_maintenanceDao;
import com.easy.service.Room_maintenanceService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class Room_maintenanceServiceImpl implements Room_maintenanceService {
    @Autowired
    Room_maintenanceDao room_maintenanceDao;
    //新增数据
    @Override
    public Room_maintenance add(Room_maintenance room_maintenance) {
        room_maintenanceDao.add(room_maintenance);
        //通过主键查询数据库中的数据
        Room_maintenance result=room_maintenanceDao.one(room_maintenance.getId());
        return result;
    }

    @Override
    public int del(Integer id) {
        return room_maintenanceDao.del(id);
    }

    @Override
    public Room_maintenance edit(Room_maintenance room_maintenance) {
        room_maintenanceDao.edit(room_maintenance);
        Room_maintenance result=room_maintenanceDao.one(room_maintenance.getId());
        return result;
    }

    @Override
    public List<Room_maintenance> all(Room_maintenance room_maintenance) {
        return room_maintenanceDao.all(room_maintenance);
    }

    @Override
    public Room_maintenance one(Integer id) {
        return room_maintenanceDao.one(id);
    }

    @Override
    public void page(Page page, Room_maintenance room_maintenance) {
        int count = room_maintenanceDao.pageCount(room_maintenance);
        Object data=room_maintenanceDao.page(page, room_maintenance);
        page.setCount(count);
        page.setData(data);
    }
}